Skip to main content

Quickly Build a Ticket Statistics and Analysis Agent

In daily IT operations, engineers often face the challenges of large ticket volumes, diverse types, and difficult analysis. Especially when needing to submit summary reports to clients or summarize the handling of a certain period, traditional methods usually rely on manual statistics and analysis, which are time-consuming, labor-intensive, and prone to errors, seriously affecting work efficiency and response speed.

To address this pain point, this tutorial will guide you to build a data source-driven ticket statistics and analysis Agent. Leveraging intelligent analysis capabilities, it enables automatic aggregation, categorized statistics, trend analysis, and other multi-dimensional processing of massive ticket data. Whether you need to quickly extract high-frequency issues, identify response bottlenecks, or generate visual reports for clients, this Agent will greatly enhance your operations team's data processing capabilities and service quality.

Data Source Preparation

In daily operations, the system regularly synchronizes ticket data to the enterprise database, forming a structured ticket record table. This data includes key information such as ticket ID, category, issue, processing status, response time, resolution duration, etc.

In this example, we will use the Data module to add a data source connected to the database for subsequent Agent analysis.

✅ Tip: For detailed data integration steps, refer to the "Data Preparation" section in "Quickly Build a Sales Intelligence Analysis Report".

  • The data source created in this example is named Microsoft Support

After ensuring the data source connection test passes and the data preview is successful, you can proceed to the next step of Agent creation.

Create Ticket Analytics Agent

Standard Creation

After integrating the data source, we will create an intelligent Agent in the standard way for automatic analysis and aggregation of ticket data.

✅ Tip: For the creation process, refer to the tutorial "Build a Simple Agent Agent from Scratch".

In this example, we create an Agent named Ticket Analytics, positioned as a data analysis Agent for operations personnel, capable of understanding user needs and automatically generating insightful reports and statistical results from the data.

The Agent creation interface is as follows:

Configure Ticket Analytics Agent

1. Prompt Configuration

  • Enter a brief prompt in the Prompt input box.
  • You can click "Generate Intelligently", and the system will call the model to automatically expand the prompt and generate a more complete version.
  • The prompt in this example is:
## Role
You are a Ticket Analytics Specialist, dedicated to extracting, analyzing, and summarizing ticket data from various data sources to help users gain actionable insights into their ticketing operations.

## Skills
1. Retrieve and aggregate ticket information:
- Access ticket data from specified data sources, ensuring comprehensive coverage of all available tickets.
- Organize ticket data by relevant attributes such as status, category, time period, and assigned personnel for further analysis.

2. Perform ticket data analysis based on user requirements:
- Analyze total ticket volume, trends over time, or distribution by specific categories as requested by the user.
- Generate clear, concise summaries and visual representations (such as tables or charts) of ticket statistics to help users understand the results easily.

## Constraints
- Only discuss topics and perform analyses directly related to ticket data; do not address unrelated subjects.
- All outputs must be organized according to the specified structure and presented in English (en-US) language.

2. Greeting Configuration

  • You can enter a custom greeting or click "Generate Intelligently" to automatically generate a welcome message.
  • The greeting in this example is:
Hello, I am Ticket Analytics, here to assist you with all your ticket analysis needs.

[How can I use Ticket Analytics to gain insights from my ticket data?] [What types of reports and analytics can you provide for my tickets?] [How can Ticket Analytics help improve my support team's performance?]

3. Model Group Settings

  • The model group (such as General Model Group) is selected during Agent creation and will be automatically displayed here.

  • You can switch as needed, but note:

    • Model group contents may differ in different environments;
    • Model group contents are pre-configured by the administrator;
    • The General Model Group used in the example includes models: gpt-4.1, DeepseekR1-Ali, Qwen3.

4. Data Source Configuration

Configuring the data source is a key step to enable the Agent to access actual ticket data. Please complete the binding as follows:

  1. Click the "+" button on the right side of the data source to open the data source selection popup;
  2. Find and select the prepared data source Microsoft Support from the list;
  3. Click the "Confirm" button in the lower right corner to complete the data source binding;
  4. After returning to the configuration interface, confirm that the data source is correctly displayed in the Agent's configuration panel;
  5. Finally, click the "Save Configuration" button in the upper right corner to ensure all settings take effect.

✅ After completing the above steps, the Agent will have access to the ticket data in the support_logs table and can perform analysis and aggregation based on this data.

The final configuration effect is as follows:

Test Q&A Effect

After completing the data source configuration, you can enter the Agent chat interface to test the effect of the ticket analysis Agent. Below is an example interaction process for this case:

  1. Enter a natural language request in the chat box

    帮我按照工单类型统计所有的工单数据并形成统计图表

As shown below:

  1. The Agent will first extract all ticket data from the data source and perform categorized aggregation based on the category field, outputting the count statistics for each ticket type;

  1. Next, the system will automatically generate a bar chart based on the statistical data, visually displaying the comparison of ticket quantities by type to help users quickly identify high-frequency issue types;

  1. Below the chart, the system will also provide an Intelligent BI Analysis Area supporting the following operations:
    • Data Preview: View the raw data used to generate the chart;
    • Chart Editing: Switch the bar chart to a line chart, pie chart, etc., or customize the X and Y axis fields;
    • SQL Query Viewing: View and copy the SQL query statement behind the current analysis for further analysis or reuse;
    • View Data: Click to jump to the original data table view;
    • Intelligent Insights: Click to let the system provide automated insights based on the current data, such as trend analysis, anomaly detection, etc.

Data Preview:

Chart Editing:

SQL Viewing:

The overall Q&A effect is as follows: